﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace SmlEngine.Media.Video
{
    /// <summary>
    /// Captures gameplay video.
    /// </summary>
    public class ScreenCapturer : IDisposable
    {
        /// <summary>
        /// The captured texture.
        /// </summary>
        public RenderTarget2D Texture { get; set; }

        private GraphicsDevice graphicsDevice;
        private Game game;

        #region Constructors, Initialization and Disposal

        /// <summary>
        /// Constructs a new ScreenCapturer instance.
        /// </summary>
        /// <param name="graphicsDevice">The GraphicsDevice to capture from.</param>
        /// <param name="game">The game to capture from.</param>
        public ScreenCapturer(GraphicsDevice graphicsDevice, Game game)
        {
            Texture = new RenderTarget2D(graphicsDevice, graphicsDevice.PresentationParameters.BackBufferHeight,
                                         graphicsDevice.PresentationParameters.BackBufferHeight, false,
                                         SurfaceFormat.Color, DepthFormat.Depth24Stencil8);

            this.graphicsDevice = graphicsDevice;
            this.game = game;
        }

        /// <summary>
        /// Disposes the texture.
        /// </summary>
        public void Dispose()
        {
            Texture.Dispose();
        }
        
        #endregion

        /// <summary>
        /// Unfinished.
        /// </summary>
        /// <param name="gameTime">Timing information for the game.</param>
        public void Capture(GameTime gameTime)
        {

        }
    }
}
